//author:kakake
class tscnmedmaterialController {
    public data = {
        dbConn: TSLobsterAPI.Program.GetDbConn()
    }

    //获取中药材数据
    getMedMaterialdata() {

        var drugName = TSLobsterAPI.Program.RequestQuery('drugName', '');
        var pageInfo = {
            key: "药材名称",
            page: TSLobsterAPI.Program.RequestQuery('page', 0),
            perPage: TSLobsterAPI.Program.RequestQuery('limit', 10),
            totalRecord: 0,
            totalPage: 0
        }

        var strsql = "";
        strsql = "SELECT 药材名称,药材别名,药材基原,性味归经,功能主治,isnull(注意事项,'') 注意事项,isnull(主要药用类别,'') 主要药用类别,标准来源,页码 \
         FROM [中药材(中国药典2020年版)]  where [药材名称] like @drugName ";

        var dbparams = {
            drugName: '%' + drugName + '%'
        }
        //获取分页Sql和条数
        var list = TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, dbparams, pageInfo);

        return { list: list, count: pageInfo.totalRecord };
    }
}